package com.alex.common.beans;

import lombok.Data;

import java.io.Serializable;

/**
 * @author baolaiqiang
 * 2019年01月01日20:58:56
 */
@Data
public class ResultBean<T> implements Serializable {

    public static final int UNKNOWN_EXCEPTION = -99;
    public static final String NOT_NULL = "文件为空";
    public static final String UPLOAD_SUCCESS = "上传成功";
    public static final int SUCCESS = 0;
    public static final int NO_LOGIN = 1;
    public static final int NO_PERMISSION = 2;
    public static final int CHECK_FAIL = 3;
    public static final int NO_RESUTL = 10;
    private static final long serialVersionUID = 1L;
    private String msg = "success";
    private int code = SUCCESS;
    private T data;

    public ResultBean() {
        super();
    }

    public ResultBean(Integer integer, String string) {
        this.code = integer;
        this.msg = string;
    }

    public ResultBean(T data) {
        super();
        this.data = data;
    }

    public ResultBean(int i, int unknownException, Throwable e) {
        super();
        //msg的信息可以通过e的类型判定并输出.
        this.msg = e.toString();
        this.code = UNKNOWN_EXCEPTION;
    }
}
